<?php

/**
 * Test
 */
class Test extends CI_Controller
{

	public function __construct()
	{
		parent::__construct();
	}

	public function index($value = '')
	{
		$this->load->model('entry_model');

		$r = $this->entry_model->get_all();

		echo "<pre>";
		print_r($r);
	}

	public function test1()
	{
		$this->load->model('comment_model');

		$res = $this->comment_model->getsById(1);

		echo "<pre>";
		print_r($res);
	}

	public function test2()
	{
		// LOAD FACEBOOK LIBRARY
		$config = array(
			'appId' => setting('app', 'id'),
			'secret' => setting('app', 'secret')
		);

		$this->load->library('facebook/facebook', $config);

		// CHECK LOGIN
		$uid = $this->facebook->getUser();

		var_dump($uid);
	}

	public function test3()
	{
		$this->load->library('email');
		$this->email->from('your@example.com', 'Your Name');
		$this->email->to('alioygur@gmail.com');

		$this->email->subject('Email Test');
		$this->email->message('Testing the email class.');

		$this->email->send();

		echo $this->email->print_debugger();

	}

	function test4()
	{

		// LOAD FACEBOOK LIBRARY
		$config = array(
			'appId' => setting('app', 'id'),
			'secret' => setting('app', 'secret')
		);

		$this->load->library('facebook/facebook', $config);
		
		var_dump($this->facebook->getAccessToken());
	}

	function test5(){
	
	echo sys_get_temp_dir();
	}
	
	function test6()
	{
		$table_name = uniqid("_tmp");
		
		$sql = "CREATE TEMPORARY TABLE {$table_name} (";
		$sql .= "`address` varchar(255) NOT NULL";
		$sql .= ", `firstname` varchar(255) NOT NULL";
		$sql .= ", `lastname` varchar(255) NOT NULL";
		$sql .= ", `gender` varchar(1) NOT NULL";
		$sql .= ", `status` enum('0', '1', '2', '3', '4') NOT NULL";
		$sql .= ", KEY `status` (`status`)";
		$sql .= ") DEFAULT CHARACTER SET=utf8";
		
		echo $sql;
		
		$this->db->query($sql);		
	}
}
